//
// Created by kepeiyang on 2021/3/5.
//

#ifndef SERVICE_MAPBEAN_H
#define SERVICE_MAPBEAN_H
#include <iostream>
#include <string>
#include <list>
#include "MapExitBean.h"


using namespace std;
class MapBean {
public:
    MapBean() = default;

    MapBean(const string &id, const string &area, const string &pname, const string &name, const string &gid,
            const string &npc, const string &mgtime, const string &ms, const string &desc, const string &boss,
            const string &qy, const string &playerinfo, const string &ispvp, const list <MapExitBean> &mapExits) : id(
            id), area(area), pname(pname), name(name), gid(gid), npc(npc), mgtime(mgtime), ms(ms), desc(desc),
                                                                                                                   boss(boss),
                                                                                                                   qy(qy),
                                                                                                                   playerinfo(
                                                                                                                           playerinfo),
                                                                                                                   ispvp(ispvp),
                                                                                                                   mapExits(
                                                                                                                           mapExits) {}

    const string &getId() const {
        return id;
    }

    void setId(const string &id) {
        MapBean::id = id;
    }

    const string &getArea() const {
        return area;
    }

    void setArea(const string &area) {
        MapBean::area = area;
    }

    const string &getPname() const {
        return pname;
    }

    void setPname(const string &pname) {
        MapBean::pname = pname;
    }

    const string &getName() const {
        return name;
    }

    void setName(const string &name) {
        MapBean::name = name;
    }

    const string &getGid() const {
        return gid;
    }

    void setGid(const string &gid) {
        MapBean::gid = gid;
    }

    const string &getNpc() const {
        return npc;
    }

    void setNpc(const string &npc) {
        MapBean::npc = npc;
    }

    const string &getMgtime() const {
        return mgtime;
    }

    void setMgtime(const string &mgtime) {
        MapBean::mgtime = mgtime;
    }

    const string &getMs() const {
        return ms;
    }

    void setMs(const string &ms) {
        MapBean::ms = ms;
    }

    const string &getDesc() const {
        return desc;
    }

    void setDesc(const string &desc) {
        MapBean::desc = desc;
    }

    const string &getBoss() const {
        return boss;
    }

    void setBoss(const string &boss) {
        MapBean::boss = boss;
    }

    const string &getQy() const {
        return qy;
    }

    void setQy(const string &qy) {
        MapBean::qy = qy;
    }

    const string &getPlayerinfo() const {
        return playerinfo;
    }

    void setPlayerinfo(const string &playerinfo) {
        MapBean::playerinfo = playerinfo;
    }

    const string &getIspvp() const {
        return ispvp;
    }

    void setIspvp(const string &ispvp) {
        MapBean::ispvp = ispvp;
    }

     list <MapExitBean> &getMapExits() {
        return mapExits;
    }

    void setMapExits(const list <MapExitBean> &mapExits) {
        MapBean::mapExits = mapExits;
    }

    string mapExits_string() {
        string out = "";

        for(MapExitBean mapExit: mapExits){
            out +=mapExit.toString();
            out += ",";
        }
        int pos = out.rfind(",");
        out.replace(pos,1,"");
        cout << out << endl;
        return out;
    }

    string toString() {
        return "{"
               "\"id\":" + id +
               ", \"area\":\"" + area + "\"" +
               ", \"pname\":\"" + pname + "\"" +
               ", \"name\":\"" + name + "\"" +
               ", \"gid\":\"" + gid + "\"" +
               ", \"npc\":" + npc +
               ", \"gtime\":\"" + mgtime + "\"" +
               ", \"ms\":" + ms +
               ", \"desc\":\"" + desc + "\"" +
               ", \"boss\":\"" + boss + "\"" +
               ", \"qy\":" + qy +
               ", \"playerInfo\":\"" + playerinfo + '\"' +
               ", \"isPvp\":" + ispvp +
               ", \"mapExits\":[" +
                    mapExits_string() +
               "]}";
    }
private:
    string id;
    string area;
    string pname;
    string name;
    string gid;
    string npc;
    string mgtime;
    string ms;
    string desc;
    string boss;
    string qy;
    string playerinfo;
    string ispvp;
    list<MapExitBean> mapExits;
};

#endif //SERVICE_MAPBEAN_H
